# Contributor: Mehdi Chinoune <mehdi.chinoune@hotmail.com>

_realname=opencl-clhpp
pkgbase=mingw-w64-${_realname}
pkgname=${MINGW_PACKAGE_PREFIX}-${_realname}
pkgver=2022.09.30
pkgrel=1
pkgdesc='OpenCL C++ header files (mingw-w64)'
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
url='https://github.com/KhronosGroup/OpenCL-CLHPP'
license=('spdx:Apache-2.0')
depends=("${MINGW_PACKAGE_PREFIX}-opencl-headers")
makedepends=("${MINGW_PACKAGE_PREFIX}-cmake"
             "${MINGW_PACKAGE_PREFIX}-ninja"
             "${MINGW_PACKAGE_PREFIX}-cc")
source=(OpenCL-CLHPP-${pkgver}.tar.gz::https://github.com/KhronosGroup/OpenCL-CLHPP/archive/refs/tags/v${pkgver}.tar.gz)
sha256sums=('999dec3ebf451f0f1087e5e1b9a5af91434b4d0c496d47e912863ac85ad1e6b2')

package() {
  cd "${srcdir}"/OpenCL-CLHPP-${pkgver}
  MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
    ${MINGW_PREFIX}/bin/cmake \
      -G'Ninja' \
      -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
      -DBUILD_DOCS=OFF \
      -DBUILD_EXAMPLES=OFF \
      -DBUILD_TESTING=OFF \
      ../OpenCL-CLHPP-${pkgver}

  DESTDIR=${pkgdir} cmake --install .

  install -D -m644 "${srcdir}"/OpenCL-CLHPP-${pkgver}/LICENSE.txt "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
}
